package org.example.rsy.service.impl;

import org.apache.tika.metadata.Metadata;
import org.example.rsy.service.BaseTikaService;
import org.springframework.stereotype.Service;


@Service
public class MetaDataTikaService extends BaseTikaService {


    @Override
    public int getCode() {
        return 1;
    }

    @Override
    public String extractData() {

        // 提取元数据
        StringBuilder metadataString = new StringBuilder();
        Metadata metadata = getMetadata();
        for (String name : metadata.names()) {
            metadataString.append(name).append(": ").append(metadata.get(name)).append("\n");
        }
        return metadataString.toString();
    }

}
